package com.zjeav.lingjiao.ui.home.persenter;

import android.support.annotation.NonNull;

import com.zjeav.lingjiao.base.request.GetVersionRequest;
import com.zjeav.lingjiao.base.response.SysSetting;
import com.zjeav.lingjiao.ui.home.model.SettingModel;
import com.zjeav.lingjiao.ui.home.view.SyssetContract;

public class SyssetPersenter implements SyssetContract.Presenter,SettingModel.OnSysSetListener {

    private SettingModel module;
    private SyssetContract.View view;

    public SyssetPersenter(SyssetContract.View view) {
        this.view = view;
        this.module = new SettingModel();
    }


    @Override
    public void getSysset(GetVersionRequest request) {
        this.module.getSet(request,this);
    }

    @Override
    public void attachView(@NonNull SyssetContract.View view) {
        this.view = view;
    }

    @Override
    public void detachView() {
        this.view = null;
    }

    @Override
    public void OnSettingSuccess(SysSetting result) {
        this.view.showSysset(result);
    }

    @Override
    public void OnError(Throwable throwable) {
        this.view.ShowError(throwable);
    }
}
